package sctu.edu.java.year2016.team07.nieying.practice.dishizhang;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

/**
 * Created by Administrator on 2016/6/1 0001.
 */
public class People {
    private  String name;
    private  long id;
    public People(String name,long id){                 //方法
        this.name=name;
        this.id=id;
    }
    public long getId(){
        return id;
    }
    public void setId(long id){
        this.id=id;
    }
    public String getName(){
        return name;
    }
    public void setName(String name){
        this.name=name;
    }
    public static void main(String[] args){
        Set<People> hashSet=new HashSet<>();
        hashSet.add(new People("陈同学",201101));
        hashSet.add(new People("王同学",201102));
        hashSet.add(new People("聂同学", 201103));
        Iterator<People>it=hashSet.iterator();
        System.out.println("集合中的元素是: ");
        while(it.hasNext()){
            People people=it.next();
            System.out.println(people.getId()+""+people.getName());
        }
    }
}
